package demo;

import demo.things.TestPaper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Controller
//@Order(1)
public class Teacher {
//    @Autowired
    @Resource
    private TestPaper testPaper;

    public Teacher() {
        System.out.println("do teacher.init()");
    }

    public void sayHi() {
        System.out.println("teacher: hi");
    }


    @Bean(name = {"testPaper1"})
    public TestPaper setTestPaper() {
        testPaper.setSubject("math");
        testPaper.setTime(120);
        return testPaper;
    }
}
